﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CoolCode.Web.Mvc.UI.Grid;

namespace CoolCode.Web.Mvc
{
    public interface IToolbarButton
    {
        IToolbarButton Named(string value);

        IToolbarButton Css(string value);

        IToolbarButton OnClick(Func<string> func);
    }

    public static class ToolbarButtonExtensions
    {
        public static ICollection<IToolbarButton> Add(this ICollection<IToolbarButton> source, Action<IToolbarButton> builder)
        {
            IToolbarButton button = new ToolbarButton();
            builder(button);
            if (!source.Contains(button))
                source.Add(button);
            return source;//return button;
        }
    }
}
